//------------------------------------------------------------------------------
//
//  File: PMHandleControlList.cpp
//
//  Copyright (C) 2007 Visual.Wei
//  Author: Wei Shuai <cpuwolf@sina.com>
//
//  Common Class for Device Driver Development
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
//
#include "PMHandleControlList.h"

PMHandleControlList::PMHandleControlList(void)
{
}

PMHandleControlList::~PMHandleControlList(void)
{
}

BOOL PMHandleControlList::Add(HWND hwnd,PMControl * pdlg)
{
	struct vlist ml;
	ml.m_hwnd=hwnd;
	ml.m_pdlg=pdlg;
	mylist.push_back( ml );
	return TRUE;
}
BOOL PMHandleControlList::Del(HWND hwnd)
{
	list <struct vlist>::iterator Iter;

	for ( Iter = mylist.begin( ); Iter != mylist.end( ); Iter++ )
	{
		if(Iter->m_hwnd==hwnd)
		{
			return TRUE;
		}
	}
	return FALSE;
}
BOOL PMHandleControlList::Del(PMControl * pdlg)
{
	list <struct vlist>::iterator Iter;

	for ( Iter = mylist.begin( ); Iter != mylist.end( ); Iter++ )
	{
		if(Iter->m_pdlg==pdlg)
		{
			return TRUE;
		}
	}
	return FALSE;
}
PMControl * PMHandleControlList::GetClassfromHandle(HWND hwnd)
{
	list <struct vlist>::iterator Iter;

	for ( Iter = mylist.begin( ); Iter != mylist.end( ); Iter++ )
	{
		if(Iter->m_hwnd==hwnd)
		{
			return Iter->m_pdlg;
		}
	}
	return NULL;
}

PMHandleControlList ControlList;